package strategy;


import strategy.model.Cat;
import strategy.model.Dog;
import strategy.service.*;

/**
 *  策略模式
 */
public class StrategyMain {
    public static void main(String[] args) {
        Cat car1=new Cat(1,2);
        Cat car2=new Cat(2,1);

        Sort sort =new Sort();

        Compartor<Cat> catCompartorW=new WeightCompare();
        int sort1 = sort.sort(car1, car2,catCompartorW);
        System.out.println(sort1);
        Compartor<Cat> catCompartorH=new HeightCompare();
        int sort2 = sort.sort(car1, car2, catCompartorH);
        System.out.println(sort2);

        Dog dog1=new Dog(2);
        Dog dog2=new Dog(5);

        Compartor<Dog> dogCompartor=new DogCompare();
        int dogCount = sort.sort(dog1,dog2,dogCompartor);
        System.out.println(dogCount);


    }
}
